package Frame;

import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;

public class FrameWithButton {
	 public static void main(String[] args) {
	        JFrame frame = new JFrame("网状布局DEMO");
	        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        frame.setSize(300,300);
	        //使用网络布局
	        frame.setLayout(new GridLayout(5,4));
	        for (int i = 0; i < 20; i++) {
	            JButton jButton =new JButton(String.valueOf(i));
	            frame.add(jButton);
	        }
	        frame.setVisible(true);
	    }

}
